#pragma once

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


#define MAX 1024

#define NONE_FLUSH (1<<0)
#define LINE_FLUSH (1<<1)
#define FULL_FLUSH (1<<2)

typedef struct IO_FILE{
	int fileno; //fd
	int flag; //打开状态
	char outbuffer[MAX]; //缓冲区
	int bufferlen; //实际缓冲区内容长度
	int flush_method; // 刷新缓冲区方法

}MYFILE;

MYFILE* MYFopen(const char* path, const char* mode);

void MYFclose(MYFILE* file);

int MYFwrite(MYFILE* file, void* str, int len);

void MYFFlush(MYFILE* file);
